<template>
  <svg :style="{ width, height }">
    <use :xlink:href="prefix + name" :fill="color"></use>
  </svg>
</template>

<script setup lang="ts">
//接受父组件传入的参数
defineProps({
  //xlink:href的前缀
  prefix: {
    type: String,
    default: '#icon-',
  },
  //图片的名字
  name: String,
  //颜色
  color: {
    type: String,
    default: '',
  },
  //图片大小
  width: {
    type: String,
    default: '16px',
  },
  height: {
    type: String,
    default: '16px',
  },
});
</script>

<style scoped></style>
